<?php
/**
 *
 * User: wufeng
 * Date: 2020/03/07
 */

namespace app\xcxapi\controller\v1;
use app\common\controller\XcxController;
use app\xcxapi\service\MyService;

class My extends XcxController
{
	/**
	 * 通知列表
	 * User: wufeng
	 * Date: 2020/03/07
	 *
	 */
	public function noticeLists()
	{
		if ($this->request->isPost()) {
			$params = $this->request->param();
			$list = (new MyService($this->type))->noticeLists($params);
			if (1 !== $list['code']) {
				$this->fail($list);
			}
			$this->win($list);
		}
		$this->fail('ILLEGAL_REQUEST');
	}

	/**
	 * 通知：发布/草稿/草稿编辑
	 * User: wufeng
	 * Date: 2020/03/07
	 *
	 */
	public function notice()
	{
		if ($this->request->isPost()) {
			$params = $this->request->param();
			$list = (new MyService($this->type))->notice($params);
			if (1 !== $list['code']) {
				$this->fail($list);
			}
			$this->win($list);
		}
		$this->fail('ILLEGAL_REQUEST');
	}

	/**
	 * 通知：发布/草稿/草稿编辑
	 * User: wufeng
	 * Date: 2020/03/07
	 *
	 */
	public function noticeDel()
	{
		if ($this->request->isPost()) {
			$params = $this->request->param();
			$list = (new MyService($this->type))->noticeDel($params);
			if (1 !== $list['code']) {
				$this->fail($list);
			}
			$this->win($list);
		}
		$this->fail('ILLEGAL_REQUEST');
	}

	/**
	 * 通知：撤销
	 * User: wufeng
	 * Date: 2020/03/13
	 *
	 */
	public function noticeCancel()
	{
		if ($this->request->isPost()) {
			$params = $this->request->param();
			$list = (new MyService($this->type))->noticeCancel($params);
			if (1 !== $list['code']) {
				$this->fail($list);
			}
			$this->win($list);
		}
		$this->fail('ILLEGAL_REQUEST');
	}

	/**
	 * 审批
	 * User: wufeng
	 * Date: 2020/03/08
	 *
	 */
	public function approval()
	{
		if ($this->request->isPost()) {
			$params = $this->request->param();
			$list = (new MyService($this->type))->approval($params);
			if (1 !== $list['code']) {
				$this->fail($list);
			}
			$this->win($list);
		}
		$this->fail('ILLEGAL_REQUEST');
	}

	/**
	 * 发起审批
	 * User: wufeng
	 * Date: 2020/03/07
	 *
	 */
	public function launchApproval()
	{
		if ($this->request->isPost()) {
			$params = $this->request->param();
			$list = (new MyService($this->type))->launchApproval($params);
			if (1 !== $list['code']) {
				$this->fail($list);
			}
			$this->win($list);
		}
		$this->fail('ILLEGAL_REQUEST');
	}

	/**
	 * 审批列表
	 * User: wufeng
	 * Date: 2020/03/07
	 *
	 */
	public function approvalLists()
	{
		if ($this->request->isPost()) {
			$params = $this->request->param();
			$list = (new MyService($this->type))->approvalLists($params);
			if (1 !== $list['code']) {
				$this->fail($list);
			}
			$this->win($list);
		}
		$this->fail('ILLEGAL_REQUEST');
	}

	/**
	 * 审批详情
	 * User: wufeng
	 * Date: 2020/03/08
	 *
	 */
	public function approvalDetail()
	{
		if ($this->request->isPost()) {
			$params = $this->request->param();
			$list = (new MyService($this->type))->approvalDetail($params);
			if (1 !== $list['code']) {
				$this->fail($list);
			}
			$this->win($list);
		}
		$this->fail('ILLEGAL_REQUEST');
	}

	/**
	 * 添加审批人
	 * User: wufeng
	 * Date: 2020/03/07
	 *
	 */
	public function approverLists()
	{
		if ($this->request->isPost()) {
			$list = (new MyService($this->type))->approverLists();
			if (1 !== $list['code']) {
				$this->fail($list);
			}
			$this->win($list);
		}
		$this->fail('ILLEGAL_REQUEST');
	}

	/**
	 * 撤销
	 * User: wufeng
	 * Date: 2020/03/08
	 *
	 */
	public function cancel()
	{
		if ($this->request->isPost()) {
			$params = $this->request->param();
			$list = (new MyService($this->type))->cancel($params);
			if (1 !== $list['code']) {
				$this->fail($list);
			}
			$this->win($list);
		}
		$this->fail('ILLEGAL_REQUEST');
	}

    /**
     *
     * User: chenben
     * Date: 2020/03/08
     *
     */
    public function achievementdetail()
    {
        if ($this->request->isPost()) {
            $params = $this->request->param();
            $list = (new MyService($this->type))->achievementdetail($params);
            if (1 !== $list['code']) {
                $this->fail($list);
            }
            $this->win($list);
        }
        $this->fail('ILLEGAL_REQUEST');
    }

	/**
	 * User: wufeng
	 * Date: 2020/03/14
	 *
	 */
    public function information()
	{
		if ($this->request->isPost()) {
			$params = $this->request->param();
			$list = (new MyService($this->type))->information($params);
			if (1 !== $list['code']) {
				$this->fail($list);
			}
			$this->win($list);
		}
		$this->fail('ILLEGAL_REQUEST');
	}

	/**
	 * 是否阅读
	 * User: wufeng
	 * Date: 2020/03/14
	 *
	 */
	public function isRead()
	{
		if ($this->request->isPost()) {
			$params = $this->request->param();
			$list = (new MyService($this->type))->isRead($params);
			if (1 !== $list['code']) {
				$this->fail($list);
			}
			$this->win($list);
		}
		$this->fail('ILLEGAL_REQUEST');
	}

	/**
	 * 上传头像
	 * User: wufeng
	 * Date: 2020/03/30
	 *
	 */
	public function uploadHead()
	{
		if ($this->request->isPost()) {
			$params = $this->request->param();
			$list = (new MyService($this->type))->uploadHead($params);
			if (1 !== $list['code']) {
				$this->fail($list);
			}
			$this->win($list);
		}
		$this->fail('ILLEGAL_REQUEST');
	}

	/**
	 * 协同列表
	 * User: wufeng
	 * Date: 2020/03/08
	 *
	 */
	public function coordination()
	{
		if ($this->request->isPost()) {
			$params = $this->request->param();
			$list = (new MyService($this->type))->coordination($params);
			if (1 !== $list['code']) {
				$this->fail($list);
			}
			$this->win($list);
		}
		$this->fail('ILLEGAL_REQUEST');
	}

	/**
	 * 协同
	 * User: wufeng
	 * Date: 2020/03/07
	 *
	 */
	public function launchCoordination()
	{
		if ($this->request->isPost()) {
			$params = $this->request->param();
			$list = (new MyService($this->type))->launchCoordination($params);
			if (1 !== $list['code']) {
				$this->fail($list);
			}
			$this->win($list);
		}
		$this->fail('ILLEGAL_REQUEST');
	}
}